<?php
if (!defined('ROOT_PATH')) die('No direct access.');
function cekSdhBeli($pembeli,$barang){
	$ret = true;
	$db = new db();
	$query = "SELECT count(*) FROM ";
	return $ret;
}

function getArtikelnya($idbarang){
	$db = new db();
	$query = "SELECT tanggal,judul,isi,tag,nama,idArtikel,`slug-judul`,type,idReview,idFB FROM `Artikel` INNER JOIN Pengguna ON idPublisher = idPengguna WHERE idReview = '$idbarang' AND type=2";
	$ret = $db->query($query);
	return $ret;
}

function editBarang($id,$nama,$berat,$harga,$desc,$pre,$tag,$kategori){
	$db = new db();
	$slug = slugging($nama);
	$query = "UPDATE Barang SET `nama` = '$nama',`slug-nama` = '$slug',`berat` = $berat,`harga` = $harga,`deskripsi` = '$desc',`preorder`=$pre,`keywords`='$tag',`kategori`=$kategori WHERE idBarang=$id ";
	$ret = $db->exec($query);
	$ret = $db->rowCount();
	if ($ret==0)
		$_SESSION['message'] = "Gagal ubah barang";
	else
		$_SESSION['message'] = "Sukses ubah barang";
}
